package com.cjm.one.security.excetion;

import com.cjm.one.common.result.ResultCodeEnum;
import lombok.Getter;
import org.springframework.security.core.AuthenticationException;


public class LoginException extends AuthenticationException {
    @Getter
    private Integer code;
    @Getter
    private String message;
    public LoginException(String msg, Throwable cause) {
        super(msg, cause);
    }
    public LoginException(ResultCodeEnum resultCodeEnum){
        super(resultCodeEnum.getMessage());
        this.code = resultCodeEnum.getCode();
        this.message = resultCodeEnum.getMessage();

    }
    @Override
    public String toString() {
        return "LoginException{" +
                "code=" + code +
                ", message=" + this.getMessage() +
                '}';
    }
}
